// 引入常态化样式
require("../../assets/css/normalize.css");
//引入重置样式
require("../../assets/css/reset.css");
// 引入公共样式
require("../../assets/css/common.css");
//引入公共模板
require("../../assets/css/tabbar.less");
require("../../assets/css/navbar.less");

// 引入阿里矢量图
require("../../assets/fonts/iconfont.css");
// 引入自己的样式
require("./sport_run.less");

//引入公共js
const dom = require("../../utils/dom.js");
const axios = require("../../utils/axios.js");
document.addEventListener("DOMContentLoaded", function () {
	dom.navbar("sport_run");
	dom.tabbar("sport_course");
	// 点击go让蒙层显示
	dom.get(".startbtn").addEventListener("click", function () {
		dom.get("#mask").style.display = "block";
		let num = 3;
		setInterval(function () {
			num--;
			dom.get("#go").textContent = num;
			if (num === 0) {
				location.href = "sport_run_ing.html";
			}
		}, 1000);
	});
	// 渲染数据
	axios.get("/api/exercise").then((res) => {
		let data = res.data.data.sum7Meter;
		if (res.data.errno === 0) {
			dom.get("#totalNum").textContent = data / 1000;
		}
	});
});
